<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>element</title>



</head>
<body>

<div id="div1">--div1---</div>
<button onclick="clicked()">按钮修改div1</button><br>

<img id="img1" src="source/aa.png" width="300" lang="200"><br>
<button onclick="clicked2()">按钮换图片</button><br>

<script>
    function clicked() {
        var div1 = document.getElementById("div1")
        console.log(div1.innerText)

        div1.innerText = "hello==="
        div1.style.backgroundColor = "red"
    }

    function clicked2() {
        var img1 = document.getElementById("img1")
        img1.src = "source/bb.png"
    }

    var div1 = document.getElementById("div1")
    div1.innerText = "aaaaa"

</script>

</body>
</html>





